<?php
class Menu {

	/**
	 * Returns array of default menu.
	 * @author AngelaMisa 03/13/2015
	 * @return array
	 */
	public static function defaultList() {
		$login_user = Auth::user()->USER_GROUP_id;
		$super_user = Auth::user()->username != Constant::SUPER_USER;

		$menu = array();
		$menu['dashboard'] = array(
			'url' 	=> URL::to('/dashboard'),
			'title' => 'Dashboard',
			'icon'	=>'fa fa-dashboard fa-lg',
		);
		
		// Order
		if ( Permission::check( 'order', 'read', $login_user ) || $super_user ) {
			$menu['order'] = array(
					'url' 	=> URL::to('order'),
					'title' => 'Orders',
					'icon'	=>'fa fa-shopping-cart fa-fw',
			);
		}
		
		// Top-up
		if ( Permission::check( 'top-up', 'read', $login_user ) || $super_user ) {
			$menu['top-up'] = array(
				'url' 	=> URL::to('top-up'),
				'title' => 'For Top-Ups',
				'icon'	=>'fa fa-credit-card fa-lg',
			);
		}
		
		// Processing
		if ( Permission::check( 'processing', 'read', $login_user ) || $super_user ) {
			$menu['processing'] = array(
				'url' 	=> URL::to('processing'),
				'title' => 'Processing Orders',
				'icon'	=>'fa fa-spinner fa-lg',
			);
		}
		
		// Purchase Order
		if ( Permission::check( 'po', 'read', $login_user ) || $super_user ) {
			$menu['po'] = array(
				'url' 	=> URL::to('po'),
				'title' => 'Purchase Orders',
				'icon'	=>'fa fa-tag fa-fw',
			);
		}
		
		// For Delivery
		if ( Permission::check( 'for-delivery', 'read', $login_user ) || $super_user ) {
			$menu['for-delivery'] = array(
				'url' 	=> URL::to('for-delivery'),
				'title' => 'For Deliveries',
				'icon'	=>'fa fa-truck fa-fw',
			);
		}
		
			// Holiday
		if ( Permission::check( 'holiday', 'read', $login_user ) || $super_user ) {
			$menu['holiday'] = array(
					'url' 	=> URL::to('holiday'),
					'title' => 'Holiday',
					'icon'	=>'fa fa-calendar fa-fw',
			);
		}

		// User Group
		if ( Permission::check( 'upload', 'read', $login_user ) || $super_user ) {
			$menu['upload'] = array(
					'url' 	=> URL::to('upload'),
					'title' => 'Uploads',
					'icon'	=>'fa fa-upload fa-fw',
			);
		}
				
		// User
		if ( Permission::check( 'user', 'read', $login_user ) || $super_user ) {
			$menu['user'] = array(
				'url' 	=> URL::to('user'),
				'title' => 'Users',
				'icon'	=>'fa fa-user fa-fw',
			);
		}
		
		// User Group
		if ( Permission::check( 'user-group', 'read', $login_user ) || $super_user ) {
			$menu['user-group'] = array(
				'url' 	=> URL::to('user-group'),
				'title' => 'User Groups',
				'icon'	=>'fa fa-users fa-fw',
			);
		}
		
		return $menu;
	}
}